ManagementApi
A class for interfacing with the Vecto Management API.
Methods:
createToken
async createToken(requestParameters: CreateTokenRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TokenDTO>
This method creates a new access token.
Args:
requestParameters (CreateTokenRequest): Parameters for creating a new token.
tokenType
: The type of the token (e.g., 'USAGE', 'PUBLIC', 'ACCOUNT_MANAGEMENT').name
: The name associated with the token.vectorSpaceIds
: An array of vector space IDs that the token should have access to.allowsAccessToAllVectorSpaces
: Whether or not the token allows access to all vector spaces.
initOverrides (RequestInit or runtime.InitOverrideFunction): Overrides for the request initialization.
Returns:
- TokenDTO: Data transfer object containing details of the created token.
id
: The unique identifier for the token.accountId
: The unique identifier for the account associated with the token.name
: The name assigned to the token.tokenType
: The type of token (described by theTokenType
).allowsAccessToAllVectorSpaces
: A boolean indicating if the token provides access to all vector spaces.token
: The actual string representation of the token.createdAt
: The date and time when the token was created.updatedAt
: The date and time when the token was last updated.vectorSpacesIds
: A list of unique identifiers for the vector spaces the token can access.
Example:
import { Configuration, ManagementApi, CreateTokenRequest, TokenType } from 'vecto-sdk';
const config = new Configuration({
accessToken: 'your-existing-token'
});
const api = new ManagementApi(config);
const createTokenParams: CreateTokenRequest = {
tokenType: 'USAGE',
name: 'Sample Token Name',
vectorSpaceIds: [123, 456], // Example vector space IDs
allowsAccessToAllVectorSpaces: false
};
const newToken = await api.createToken(createTokenParams);
createVectorSpace
async createVectorSpace(requestParameters: CreateVectorSpaceRequest = {}, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<VectorSpaceResponse>
This method creates a new vector space.
Args:
requestParameters (CreateVectorSpaceRequest): Parameters for creating a new vector space.
name
: The name of the new vector space.modelId
: The ID of the model associated with the vector space.
initOverrides (RequestInit or runtime.InitOverrideFunction): Overrides for the request initialization.
Returns:
- VectorSpaceResponse: Data transfer object containing details of the created vector space.
id
: The unique identifier for the vector space.name
: The name assigned to the vector space.model
: details of the model, specified byModelInformation
.id
: The unique identifier for the model.modality
: The specific modality of the model.name
: Model name.description
: Overview of the model.
Example:
import { Configuration, ManagementApi, CreateVectorSpaceRequest } from 'vecto-sdk';
const config = new Configuration({
accessToken: 'your-existing-token'
});
const api = new ManagementApi(config);
const createVectorSpaceParams: CreateVectorSpaceRequest = {
newVectorSpaceRequest: {
name: 'Sample Vector Space Name',
modelId: 1 // Example model ID
}
};
const newVectorSpace = await api.createVectorSpace(createVectorSpaceParams);
deleteEntry
async deleteEntry(requestParameters: DeleteEntryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>
This method deletes an entry in a vector space.
Args:
- requestParameters (DeleteEntryRequest): Parameters to identify the entry to be deleted.
vectorSpaceId
: The ID of the vector space containing the entry.entryId
: The ID of the entry to be deleted.
- initOverrides (RequestInit or runtime.InitOverrideFunction): Overrides for the request initialization.
Example:
import { Configuration, ManagementApi, CreateVectorSpaceRequest } from 'vecto-sdk';
const config = new Configuration({
accessToken: 'your-existing-token'
});
const api = new ManagementApi(config);
const deleteEntryParams: DeleteEntryRequest = {
vectorSpaceId: 123, // Example vector space ID
entryId: 456 // Example entry ID
};
await api.deleteEntry(deleteEntryParams);
deleteToken
async deleteToken(requestParameters: DeleteTokenRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ActionStatusResponse>
This method deletes an access token.
Args:
- requestParameters (DeleteTokenRequest): Parameters to identify the token to be deleted.
id
: The ID of the token to be deleted.
- initOverrides (RequestInit or runtime.InitOverrideFunction): Overrides for the request initialization.
Returns:
- ActionStatusResponse: Data transfer object indicating the status of the delete operation.
Example:
import { Configuration, ManagementApi, CreateVectorSpaceRequest } from 'vecto-sdk';
const config = new Configuration({
accessToken: 'your-existing-token'
});
const api = new ManagementApi(config);
const deleteTokenParams = { id: 12345 }; // Example token ID
const statusResponse = await api.deleteToken(deleteTokenParams);
deleteVectorSpace
async deleteVectorSpace(requestParameters: DeleteVectorSpaceRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ActionStatusResponse>
This method deletes a vector space specified by its ID.
Args:
- requestParameters (DeleteVectorSpaceRequest): Parameters to identify the vector space to be deleted.
id
: The ID of the vector space to be deleted.
- initOverrides (RequestInit or runtime.InitOverrideFunction): Overrides for the request initialization.
Returns:
- ActionStatusResponse: Data transfer object indicating the status of the delete operation.
Example:
import { Configuration, ManagementApi, CreateVectorSpaceRequest } from 'vecto-sdk';
const config = new Configuration({
accessToken: 'your-existing-token'
});
const api = new ManagementApi(config);
const deleteVectorSpaceParams = { id: 12345 }; // Example vector space ID
const statusResponse = await api.deleteVectorSpace(deleteVectorSpaceParams);
listData
async listData(requestParameters: ListDataRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DataPage>
This method lists the attributes of all entries in the given vector space.
Args:
requestParameters (ListDataRequest): Parameters to list data.
vectorSpaceId
: The ID of the vector space.limit
: Limit the number of returned entries.offset
: The offset for pagination.
initOverrides (RequestInit or runtime.InitOverrideFunction): Overrides for the request initialization.
Returns:
- Array(DataPage): Returns an array of
DataEntry
elements from the vector space. EachDataEntry
contains:count
: The total number of data entries in the vector space.elements
: List of individual data entries, described byDataEntry
.id
: The unique identifier for the data entry.attributes
: Arbitrary JSON value providing additional details about the data entry.
Example:
import { Configuration, ManagementApi, CreateVectorSpaceRequest } from 'vecto-sdk';
const config = new Configuration({
accessToken: 'your-existing-token'
});
const api = new ManagementApi(config);
const listDataParams: ListDataRequest = {
vectorSpaceId: 123, // Example vector space ID
limit: 10, // Example limit
offset: 0 // Example offset
};
const dataPage = await api.listData(listDataParams);
listModels
async listModels(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<ModelInformation>>
This method lists all available models.
- initOverrides (RequestInit or runtime.InitOverrideFunction): Overrides for the request initialization.
Returns:
- Array(ModelInformation): An array containing
ModelInformation
elements. EachModelInformation
contains:id
: The unique identifier for the model.modality
: The specific modality of the model.name
: The name given to the model.description
: A detailed description or overview of the model.
Example:
import { Configuration, ManagementApi, CreateVectorSpaceRequest } from 'vecto-sdk';
const config = new Configuration({
accessToken: 'your-existing-token'
});
const api = new ManagementApi(config);
const models = await api.listModels();
listTokens
async listTokens(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<TokenResponse>>
This method retrieves a list of tokens.
- initOverrides (RequestInit or runtime.InitOverrideFunction): Overrides for the request initialization.
Returns:
- Array(TokenResponse): An array where each element is a
TokenResponse
detailing specific information about a token. EachTokenResponse
contains:id
: The unique identifier for the token.name
: The name assigned to the token.tokenType
: The type of token.vectorSpaceIds
: List of unique identifiers for the vector spaces the token can access.allVectorSpaces
: Boolean indicating if the token provides access to all vector spaces.createdAt
: The date and time when the token was created.
Example:
import { Configuration, ManagementApi, CreateVectorSpaceRequest } from 'vecto-sdk';
const config = new Configuration({
accessToken: 'your-existing-token'
});
const api = new ManagementApi(config);
const tokens = await api.listTokens();
listVectorSpaces
async listVectorSpaces(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<VectorSpaceResponse>>
This method retrieves a list of vector spaces.
- initOverrides (RequestInit or runtime.InitOverrideFunction): Overrides for the request initialization.
Returns:
- Array(VectorSpaceResponse): An array where each element is a
VectorSpaceResponse
providing details about a specific vector space. EachVectorSpaceResponse
contains:id
: The unique identifier for the vector space.name
: The name assigned to the vector space.model
: Information about the associated model, defined byModelInformation
.id
: The unique identifier for the model.modality
: The specific modality of the model.name
: The name of the model.description
: A description or overview of the model.
Example:
import { Configuration, ManagementApi, CreateVectorSpaceRequest } from 'vecto-sdk';
const config = new Configuration({
accessToken: 'your-existing-token'
});
const api = new ManagementApi(config);
const vectorSpaces = await api.listVectorSpaces();
updateVectorSpace
async updateVectorSpace(requestParameters: UpdateVectorSpaceOperationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<VectorSpaceResponse>
This method updates the properties of a vector space specified by its ID.
Parameters:
- requestParameters (UpdateVectorSpaceOperationRequest): Contains the required details to update the vector space. This includes:
- id: The ID of the vector space to update.
- updateVectorSpaceRequest: The request parameters to update the vector space.
- initOverrides (RequestInit or runtime.InitOverrideFunction): Overrides for the request initialization.
Returns:
- VectorSpaceResponse: An object containing the updated details of the vector space.
id
: The unique identifier for the vector space.name
: The name assigned to the vector space.model
: Information about the associated model, defined byModelInformation
.id
: The unique identifier for the model.modality
: The specific modality of the model.name
: The name of the model.description
: A description or overview of the model.
Example:
import { Configuration, ManagementApi, CreateVectorSpaceRequest } from 'vecto-sdk';
const config = new Configuration({
accessToken: 'your-existing-token'
});
const api = new ManagementApi(config);
const updateRequest = {
id: 123,
updateVectorSpaceRequest: {
name: "Updated Name"
// ... other parameters to update
}
};
const updatedVectorSpace = await api.updateVectorSpace(updateRequest);